Relationship serialization and reconstruction for entities

ABSTRACT

Systems and methods that enable relationship information to be carried along with data objects when serializing/deserializing data objects among application tiers. A tracking component tracks information on relationships associated with a data object, and further enables subsequent change processing on the data object&#39;s relationship information. Accordingly, relationship information can be carried along with the data object, such that database operation can be performed without requirement of additional information from the database (e.g., foreign key information that is part of associated graphs).

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of, and claims the benefit of U.S.patent application Ser. No. 14/335,517, filed Jul. 18, 2014, entitled“RELATIONSHIP SERIALIZATION AND RECONSTRUCTION FOR ENTITIES,” which is adivisional of U.S. patent application Ser. No. 12/146,862, filed Jun.26, 2008, entitled “RELATIONSHIP SERIALIZATION AND RECONSTRUCTION FORENTITIES”, now U.S. Pat. No. 8,805,776. The entire contents of each ofthe foregoing applications are incorporated herein by reference in theirentireties.

BACKGROUND

Data has become an important asset in almost every application, whetherit is a Line-of-Business (LOB) application utilized for browsingproducts and generating orders, or a Personal Information Management(PIM) application used for scheduling a meeting between people.Applications perform both data access/manipulation and data managementoperations on the application data. Typical application operations querya collection of data, fetch the result set, execute some applicationlogic that changes the state of the data, and finally, persist the datato the storage medium.

Traditionally, client/server applications relegated the query andpersistence actions to database management systems (DBMS), deployed inthe data tier. If data-centric logic, it is coded as stored proceduresin the database system. The database system operated on data in terms oftables and rows, and the application, in the application tier, operatedon the data in terms of programming language objects (e.g., Classes andStructs). With the advent of the web technology (and Service OrientedArchitectures) and with wider acceptance of application servers,applications are becoming multi-tier, and more importantly, data is nowpresent in every tier.

In such tiered application architectures, data is manipulated inmultiple tiers. In addition, with hardware advances in addressabilityand large memories, more data is becoming memory resident. Applicationsare also dealing with different types of data such as objects, files,and XML (eXtensible Markup Language) data, for example.

In hardware and software environments, the need for rich data access andmanipulation services well-integrated with the programming environmentsis increasing. Moreover, serializing entities (e.g., objectrepresentation of data) for subsequent use in n-tier Service OrientedArchitecture (SOA) can be burdened with inefficiencies. For example,serializing relationship information is not intuitive at the entityabstraction, and it is burdensome to include adequate information forreconstructing the first class relationship.

SUMMARY

The following presents a simplified summary in order to provide a basicunderstanding of some aspects described herein. This summary is not anextensive overview of the claimed subject matter. It is intended toneither identify key or critical elements of the claimed subject matternor delineate the scope thereof. Its sole purpose is to present someconcepts in a simplified form as a prelude to the more detaileddescription that is presented later.

The subject innovation provides for tracking of information related torelationships when serializing/deserializing entities among applicationtiers—via a tracking component. Such tracking component can include asystem employed to track entities throughout their lifetime in acomputer system; such as tracking changes made to scalar dataproperties, relationships, and the like—wherein such changes can includeadditions, edits, or deletions, for example. Moreover, the trackingcomponent can include key information that are introduced to preserveassociations and mitigate a requirement to re-load entities from adatabase, and hence reduces amount of information involved in roundtripsand in web service operations. Accordingly, relationship information canbe carried along with the entity, wherein subsequent database operationscan be performed without requirement of additional information from thedatabase (e.g., foreign key information that is part of associatedgraphs). Moreover, information about related entities in a serializedpayload can also be included in the serialized payload. Such anarrangement further enable users to perform subsequent change processingon the entity's relationship information (which can be more efficientlyperformed than retrieval of the full related entity) and supplies anefficient discovery of information concerning the related entity.

In a related aspect, an entity that exposes a cardinality onerelationship can include an EntityReference instance as a property, andby including an EntityKey on such EntityReference, key information canbe transported as a proxy for the full entity during serialization.

Whenever an entity is being tracked by a context, the EntityKeyinformation can be represented by either the EntityKey from the fullrelated entity or as a proxy for the full related entity. If an entitythat contains a related proxy is attached to a tracking context after aserialization operation, the context determines whether a full entityfor the proxy is already being tracked and if it is, the context willtransform the entity graph by replacing the proxy with the full entity.Likewise, if the context is not tracking the full related entity,subsequent operations that introduce the full related entity can alsocause a transformation where tracked entity graphs are updated with thefull related entity.

In a related methodology, initially a query is executed against adatabase and an entity can be retrieved. Once an entity is obtained,entity references can subsequently be retrieved therefrom, wherein eachentity reference can contain the EntityKey that is the combination ofdata values and set information. A plurality of actions can then beperformed via the key, such as serializing schema to a webpage andreducing associated payloads and service calls when updating thedatabase, for example. It is to be appreciated that customer classes canbe created to represent entities (e.g., CLR object) and keys can besubsequently associated therewith.

As such, when serializing an entity for use in a multi-tier ServiceOriented Architecture (SOA) application, the tracking component includesinformation about related entities in the serialized payload, whereinsuch information can serve as a first class proxy for the full relatedentity. Such further enables users to perform subsequent changeoperations on the entity's relationship information, and facilitateefficient retrieval of the full related entity for discovery ofassociated information. When the proxy is introduced into an objectrelational mapping (ORM) context, it is also necessary for the proxy tobe replaced in all entity graphs with the full entity if it is presentin the context. Moreover, the entity relationship information can beserialized to a variety of formats that are interoperable betweendifferent computer architectures.

To the accomplishment of the foregoing and related ends, certainillustrative aspects of the claimed subject matter are described hereinin connection with the following description and the annexed drawings.These aspects are indicative of various ways in which the subject mattermay be practiced, all of which are intended to be within the scope ofthe claimed subject matter. Other advantages and novel features maybecome apparent from the following detailed description when consideredin conjunction with the drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates a block diagram of a tracking component that tracksentity relationships when serializing/deserializing entities accordingto an aspect of the subject innovation.

FIG. 2 illustrates a serialization system that interacts with a trackingcomponent according to an aspect of the subject innovation.

FIG. 3 illustrates a further serialization system that employs atracking component in accordance with an aspect of the subjectinnovation.

FIG. 4 illustrates a methodology of tracking relationships according toan aspect of the subject innovation.

FIG. 5 illustrates a further methodology of serializing/deserializing anentity via a tracking component according to a particular aspect of thesubject innovation.

FIG. 6 illustrates an exemplary block diagram of attaching entities viaa tracking component in accordance with an aspect of the subjectinnovation.

FIG. 7 illustrates a system that implements a tracking component thatenables tracking of information related to relationships whenserializing/deserializing entities among application tiers.

FIG. 8 illustrates an exemplary environment for implementing variousaspects of the subject innovation.

FIG. 9 is a schematic block diagram of a sample-computing environmentthat can be employed for a tracking according to an aspect of thesubject innovation.

DETAILED DESCRIPTION

The various aspects of the subject innovation are now described withreference to the annexed drawings, wherein like numerals refer to likeor corresponding elements throughout. It should be understood, however,that the drawings and detailed description relating thereto are notintended to limit the claimed subject matter to the particular formdisclosed. Rather, the intention is to cover all modifications,equivalents and alternatives falling within the spirit and scope of theclaimed subject matter.

FIG. 1 illustrates a block diagram of a system 100 that employs atracking component 110 when serializing/deserializing entities 111, 113,115 (1 thru n, n being an integer) according to an aspect of the subjectinnovation. The tracking component 110 can include key information thatare introduced to preserve associations and mitigate a requirement tore-load entities 111, 113, 115 from the database 125, and hence reducesamount of information involved in roundtrips and in web serviceoperations. Any of such entities 111, 113, 115 can include a particularobject type within a multi-dimensional structure, wherein such structureexists within a data store of the database 125. The multi-dimensionalstructure can be, for instance, a data cube, a dimension associated witha data cube and/or a sourceless dimension, an attribute hierarchy, anattribute, or the like. In general, in such an environment, an EntityKeycan represent information that is required to identify an entity thatincludes a set of data values and a set identifier. Likewise, anEntityReference represents a cardinality one relationship, and caninclude three pieces of information: the relationship meta informationusing to identify this relationship, the full value of the relatedentity, and the key value of the related entity.) It is to beappreciated that a relationship, as defined by the Entity Data Model, isa first class construct. Hence, such a relationship is not merely aprimary-key to foreign key relationship (e.g., an example for suchdifference is that a first class relationship can include a link table,such as many to many relationship that cannot be done with a typicalforeign key.

Moreover, the queries 130 to the database 125 can be constructed inaccordance to a standard query language (e.g., structured query language(SQL)) in order to access content of the tables 117, 119 (1 thru m, mbeing an integer) in the database 125. Likewise, data can be input(e.g., imported) into the tables 117, 119 via an external source, andthe Database 125 can typically be modeled by using data modelinglanguages, such as the Entity Data Model, and the Unified Data ModelLanguage (UML)—which supply representations in form of entities andrelationships. For example, in a database that holds data relating toAuthors and Documents, the document and author can be treated asentities, and “WrittenBy” can be designated as a relationship. Arelationship definition commonly can have a cardinality associatedtherewith. As such, in a database environment there can exist one-to-one(1:1), one-to-many (1:N), and many-to-many (N:M) relationships (where Nand M are integers)—wherein one-to-one and one-to-many relationships canbe captured in SQL through referential constraints. Likewise,many-to-many relationships can typically be modeled by introducing anintermediate table (e.g., WrittenBy) that captures such relationship.Moreover, relational joins can be provided that dynamically learn thevarious relationships created—(as compared to the static existingforeign key (FK)—primary key (PK) relationship)—so as the databasegrows, such relation join can guide the compiler to spell out thereference join.

The existing relationships can be in form of a primary key (PK)—foreignkey (FK), wherein the foreign key can be a column or combination ofcolumns used to establish and enforce a link between the data of asource table and a target table, for example. As explained earlier, thetables 117, 119 can tabulate: “Document”, “Author”, and “Written by” ina many-to-many relationship that exists among them, wherein Document andAuthor are entities, while WrittenBy is a relationship. Typically, sucha relationship definition has a cardinality associated therewith. It isto be appreciated that the above example is for illustrative purposes,and there can exist one-to-one (1:1), one-to-many (1:N), andmany-to-many (N:M) relationships (N and M being integers), wherein suchrelationships can be typically captured in SQL through referentialconstraints, and many-to-many relationships are commonly modeled byintroducing an intermediate table (e.g., WrittenBy) that can capture therelationship.

As such, for an entity that exposes a cardinality one relationship as anEntityReference instance as a property, the tracking component 110 ofthe subject innovation supplies an EntityKey on such EntityReference,wherein key and set information can be transported as a proxy for thefull entity during serialization. Whenever an entity is being tracked bya context, the EntityKey information can be represented by either theEntityKey from the full related entity or as a proxy for the fullrelated entity. If an entity that contains a related proxy is attachedto a tracking context after a serialization operation, the contextdetermines whether a full entity for the proxy is being tracked and ifit is, the context will transform the entity graph by replacing theproxy with the full entity. Likewise, if the context is not tracking thefull related entity, subsequent operations that introduce the fullrelated entity will also cause a transformation where tracked entitygraphs are updated with the full related entity.

FIG. 2 illustrates a serialization system 200 that interacts with atracking component 250 in accordance with an aspect of the subjectinvention. The system 200 can be employed to serialize an item andentity(ies) associated therewith. Such system 200 can further generateand serialize a header that includes information associated with theitem and associated entity(ies). As compared to conventional systems,the subject innovation enables relationships to be reconstructed whenattached to the tracking component 250. For example, one conventionalserialization is the scenario of a Foreign key serialization, wherein anentity is serialized and part of that entity are data values that referto a related entity. Another example of conventional serialization caninclude full graph serialization, wherein the relationship is serializedby way of both ends of the relationship being serialized. This containssubstantial amount of data because two full entities are beingserialized. In contrast to such scenarios, the subject innovationenables an EntityKey for the related entity to be serialized along withan entity, to reconstruct the relationship when attached to the trackingcomponent 250.

As illustrated, the serialization system 200 includes an identificationcomponent 210 that identities entity(ies) associated with an item. Theidentification component 210 can obtain information regarding the itemfrom a file system store 220. The information can include itemfragment(s), extension(s), outgoing link(s), incoming link(s) and/orembedded item(s), for example. The serialization system 200 furtherincludes a serialization component 230 that serializes the item andassociated entity(ies). The serialization component 230 can furthergenerate and serialize a header that includes information associatedwith the item and associated entity(ies). The header can facilitaterandom access to the item and associated entity(ies) (e.g., allowing areader to interpret/parse only the parts in which it is interested). Thetracking component 250 permits relationship information to be carriedalong with the entity, such that database operation is performed withoutrequiring additional information from the database (e.g., foreign keyinformation that is part of associated graphs). Hence, information aboutrelated entities in a serialized payload can also be included in suchserialized payload. This arrangement further enables users to performsubsequent change processing on the entity's relationship information(which can be more efficiently performed than retrieval of the fullrelated entity) and better discovery of information concerning therelated entity.

FIG. 3 illustrates a further serialization system 300 that implements atracking component of the subject innovation. An APIs 310 facilitatescommunication between the system 300 and application(s) 320. Forexample, the APIs 310 can facilitate copying, moving and/or transfer ofan item and its associated entity(ies) from one location to anotherlocation (e.g., separate computer system and/or removable media). Thus,the APIs 310 can be employed for item level operations such as Export,Backup, Restore, Copy, and the like. In one example, the application 320can selectively include all or part(s) of an item by providingserialization information (e.g., flag(s)) to the API 310. The APIs 310can be exposed at the file system level and/or at the store procedurelevel. The tracking component 350 enables tracking of information onrelationships, and can typically employ two aspects, namely:graphmanagement and serialization.

Graph Management

EntityReference

EntityReference can contain a public read-write EntityKey property. Thevalue returned from such property can be the current EntityKey for thatside of the relationship. Moreover, such property's value can beretrieved differently depending on the state of the owning entity. Forexample for the scenarios of;

A. Retrieving the Value of the EntityReference.EntityKey Property whilethe Entities are in the ObjectStateManager (Aka Attached Graphs):

For attached entities when the EntityKey property is accessed, thetracking context can look up the appropriate value as follows:

If EntityReference.Value is non-null, the context can look up theEntityKey for that entity in the state manager and return it. Forattached entities the context can determine an EntityKey.

If EntityReference.Value is null, there can exist a relationship with astub entry (proxy for a full entity), so next the context can lookthrough the source entity's relationships to verify if it can find anAdded or Unchanged one. Moreover, there can exist a single added or oneUnchanged relationship that can match what the context is looking for,so as soon one is found, the context can return the EntityKey for theother side. Moreover, if the EntityKey for the object is temporary orone of the special keys, the EntityKey property can return null.

B. Retrieving the Value of the EntityReference.EntityKey Property whilethe Entities are not in the ObjectStateManager (Aka Detached Graphs):

For detached entities, the EntityReference.EntityKey property can returnthe value of a private field that stores the EntityKey value, which willhave been set during serialization or Detach as described supra. Suchoccurs as there is no tracking component to lookup the key or metadatato create the key.

Setting the EntityReference.EntityKey property:

For attached scenarios, setting of temporary keys or special keys likeEntityKey.NoEntitySetKey is typically not permitted, and an exception isincorporated in such cases. For detached graphs, due to someserialization scenarios that build the key up in stages, setting thesekey values is allowed, and yet can fail with the same exception whenattempting to Add/Attach an EntityReference to a tracking context withone of these keys.

For attached graphs, if the user sets the EntityKey property, thefollowing behavior can be demonstrated:

-   -   1. The context can locate an ObjectStateEntry for the EntityKey,        and if one does not exist, the context can add a key entry in        the unchanged state (key/stub entries are always Unchanged).    -   2. If an ObjectStateEntry with that key is found, or if one is        created, the Value property can be set to null on the reference,        and will create a new Added relationship between the source        entity and the stub. If Value was previously non-null, such can        also mark that relationship as Deleted.    -   3. If a real entity entry with that key is located, the        EntityReference.Value is set to that new entity. Such has the        effect of marking the existing relationship as Deleted and        adding a new one in the Added state.

Such can further have the same effect as setting the Value property,wherein it is typically not necessary to have the whole target entity inorder to create the relationship. Accordingly, in the end, therelationship can be with a proxy/stub instead of a real entity.

Likewise, for detached graphs, if the user sets the EntityKey propertyit can exhibit the following behavior:

-   -   1. The value can be set regardless of whether        EntityReference.Value is null or not.    -   2. If EntityReference.Value is not null,one cannot always obtain        an EntityKey from that entity because it may not even implement        IEntityWithKey (the Entity Framework's mechanism for accessing        an EntityKey on an entity), or may not have a key set at all,        and the entity cannot create one because it doesn't have the        metadata to know how to do that (because it is detached from a        context). Therefore, at the time the property is set no        comparison between the EntityKey on the Value and the one being        set directly on the EntityReference can be performed.    -   3. If EntityReference.Value is not null, when the entity is        attached or added to the context the key on that entity can        always be determined and if it does not match the one in the        EntityReference.EntityKey, the context can implement an        exception.

Saving the value of the EntityReference.EntityKey property duringObjectContext.Detach, and NoTracking scenarios:

Because the EntityKey property should typically be accessible ondetached entities, and therefore cannot employ the lookup strategydescribed above for attached entities, during ObjectContext.Detach, fullspan with NoTracking, and Load with NoTracking, the EntityKey shouldtypically be privately maintained in a field on the EntityReference.

In addition, for detached graphs that were retrieved withMergeOption.NoTracking and full span or Load, the context andmaterializer can have to set the EntityReference.EntityKey at the timethat the relationship is created during span/Load.

With ObjectContext.Detach, the context traverses the detached entity anddisconnects the related ends. Before each EntityReference is cleared,the value of the EntityKey property (which can perform the lookup asdescribed above) should typically be saved into the privately maintainedfield. Such process can also separately detach relationships with stubentity entries in the ObjectStateManager, such that it can also saveEntityKey into an EntityReference at that point for any of theserelationships that are in the Added or Unchanged state.

Behavior when Manually Creating Relationships

A relationship can be considered to be manually created by the user inthe following cases:

-   -   EntityReference.Value is set    -   EntityCollection.Add is used to create a relationship in a        1-to-many scenario (because the the relationship manager always        hook up both sides of the relationship, the Value is set here)    -   When you call IRelatedEnd.Add on an EntityReference

The following describes the expected effect on the EntityKey propertywhen manually creating relationships on an attached entity. The behavioron an attached entity is dependent on how the setting of the Valueaffects the relationships in the state manager. For example, if theValue is set to a particular entity, the resulting EntityKey propertyvalue can be the same as the key on that Value, unless the Value is inthe Added state in which case it can have a temporary key and EntityKeycan return null. If the Value is set to null, the EntityKey can be null.In one aspect, even if the Value was already null, setting it to nullagain can ensure that an Added or Unchanged relationship with a stub canbe deleted.

The following is the expected effect on the EntityKey property whenmanually creating relationships on a detached entity: The EntityKeyproperty can maintain its value when the Value of the relationship isset.

Behavior during Attach/AttachTo/AddObject:

When adding an entity to a context withObjectContext.Attach/AttachTo/Add, as the context traverses the graph,if it finds a stub EntityReference it can also implement the followingadditional rules:

-   -   1. There can exist a real entity or stub entity entry already in        the context with the same key as the stub EntityReference. In        such case, the context can add a new relationship between the        source entity and the key in the stub EntityReference. If the        target end is a real entity and it is a 1:1 relationship, the        context typically needs to hook up the related ends between the        entities.    -   2. If there exists no entity state entry with the same key as        the stub EntityReference, the context needs to add a stub entry        as well as the new relationship.

After adding a relationship with Attach/AttachTo/AddObject, the contextwill not null out the privately maintained EntityKey stored in theEntityReference because although it is not meaningful on attachedentities, it is also not used. However, there are some cases where it isimportant to do null it out later on, such as when deletingrelationships. Such typically ensures proper operation when an entity islater serialized or detached and only Deleted relationships exists, thenthe EntityReference will not incorrectly pick up an old value.

The context can also verify that if an EntityReference has both anEntityKey and a Value, that the EntityKey is the same as the EntityKeyfor the entity in Value. Note that when an entity is added to thetracking context, all entities are Added with temporary keys, so in thatcase, because it is not allowed to set temporary keys on the EntityKeyproperty, the EntityKey property will have to be null.

Serialization

Binary: With binary serialization, the RelationshipManager is serializedon an entity, which includes all of its collections and references. Thiscan automatically serialize the privately maintained EntityKey field oneach EntityReference, but an entity has to make sure it gets set priorto serialization, since it will not be kept updated for attachedentities.

Such can be performed by employing the .NET Framework's binaryserialization mechanism OnSerializingAttribute. Accordingly, if theRelationshipManager is already detached from a context (includingNoTracking), it will do nothing since the private EntityKey fields canalready be set at that point. If the RelationshipManager is attached toa context, it can traverse through the Added or Unchanged relationshipentries for the source entity and set the private EntityKey fields onall of the references that are found. Such can further automaticallypick up all of the references that were already known to theRelationshipManager (e.g., those that have actual Values in them) aswell as those that are still associated with stubs only (in which case acall to GetRelatedEnd can automatically create a new EntityReference aswell).

Windows Communication Foundation (WCF):

To enable WCF serialization, the EntityReference class can be attributedwith DataContract and the EntityKey property can be attributed withDataMember. All navigation properties that return EntityReference canalso require the DataMember attribute in order for that relationship tobe serialized with the entity, so codegen can automatically add thisattribute to those properties.

XML

To enable XML serialization, the EntityKey property can include a publicgetter and setter. All navigation properties that return EntityReferencecan also require a public getter and setter in order to be serialized,so codegen can provide a setter for these properties. Such setter can berepresented by:

set { if ((value != null)) {((global::System.Data.Objects.DataClasses.IEntityWithRela tionships)(this)).RelationshipManager.InitializeRelatedReference<Category>(“ObjectServices.EntityReferenceTest.Northwind.CategoryProduct”, “Category”, value); } }

In the above, InitializeRelatedReference<T>(string relationshipName,string targetRole, EntityReference<T>entityReference) is a public methodon the RelationshipManager. Its purpose is to callGetRelatedReference<T> with the same arguments, and instead of creatinga new reference and setting all of the necessary internal members, itcan set such members directly onto the EntityReference that is passedin.

Such can incorporate an exception if the EntityReference is alreadyinitialized (e.g., if it has an owner) or if the source entity isattached to a context. If the source entity already has anEntityReference with the same properties as the new one, it has to justremove the old one and add the new one to the list of relationships inthe RelationshipManager.

FIG. 4 illustrates a related methodology of tracking relationshipsaccording to an aspect of the subject innovation. While the exemplarymethod is illustrated and described herein as a series of blocksrepresentative of various events and/or acts, the present invention isnot limited by the illustrated ordering of such blocks. For instance,some acts or events may occur in different orders and/or concurrentlywith other acts or events, apart from the ordering illustrated herein,in accordance with the invention. In addition, not all illustratedblocks, events or acts, may be required to implement a methodology inaccordance with the present invention. Moreover, it will be appreciatedthat the exemplary method and other methods according to the inventionmay be implemented in association with the method illustrated anddescribed herein, as well as in association with other systems andapparatus not illustrated or described. Initially and at 410, a query isexecuted against a database to retrieve an entity at 420. At 430 atracking component supplies information that enables tracking ofrelationships associated with the entity. Such tracking component caninclude key information that are introduced to preserve associations at440, and hence mitigate a requirement to re-load entities from adatabase, and further reduces amount of information involved inroundtrips and in web service operations.

FIG. 5 illustrates a related methodology of serializing/deserializing anentity via the tracking component in accordance with an aspect of thesubject innovation. Initially and at 510, reference relation ships forthe entity can be obtained from the tables of the database. The trackingcomponent can include key information that are introduced to preserveassociations and mitigate a requirement to re-load entities from adatabase, wherein the key information can be transported as a proxy forthe full entity during serialization. For example and as described indetail supra, whenever an entity is being tracked by a context, such Keyinformation can be represented by either an EntityKey from the fullrelated entity or as a proxy for the full related entity. Subsequentlyand at 530, serialization processes can be initiated, wherein if anentity that contains a related proxy is attached to a tracking contextafter a serialization operation, the context can determine whether afull entity for the proxy is being tracked. If so, the context cantransform the entity graph by replacing the proxy with the full entity.Likewise, if the context is not tracking the full related entity,subsequent operations that introduce the full related entity can alsocause a transformation where tracked entity graphs are updated with thefull related entity. Accordingly, change processing can be readilyperformed on relationship information for the entity, to reduce amountof information involved in roundtrips and in web service operations.

FIG. 6 illustrates an exemplary block diagram of attaching entities viaa tracking component in accordance with an aspect of the subjectinnovation. In one aspect, the entity can already contain full entitythat transforms the entity graph to include the full entity. Forexample, 610 can represent original entity after serialization, and 620illustrates a scenario of attaching an entity to an empty trackingcontext that creates proxy entry O1-CK1. As such, O1 611 can representan order, and the ER 612 represents the entity reference that isassociated with information on the customer, which includes the fullcustomer records with the key information represented as CK1 616.Accordingly, a plurality of actions can be performed with such keys suchas serializing scheme to a web page, wherein instead of taking the O1and creating a new relation ship and move it to another customer, thekey can supply a pointer to such other customer. Hence, informationabout related entities in a serialized payload can also be included inthe serialized payload. Such an arrangement further enables users toperform subsequent change processing on the entity's relationshipinformation (which can be more efficiently performed than retrieval ofthe full related entity) and better discovery of information concerningthe related entity. Likewise, 630 illustrates attaching the entity to atracking context that already contains the full entity Cl transforms theentity graph to include the full entity.

FIG. 7 illustrates a system 700 that implements a tracking component 722that enables tracking of information related to relationships whenserializing/deserializing entities among application tiers, whereinrunning on the client 720 is a client process, for example, a webbrowser 710. Likewise, running on the server 750 is a correspondingserver process, for example, a web server 760. In addition, embedded inthe Web Browser 710 can be a script or application 730, and runningwithin the run-time environment 740 of the client computer 720, canexist a proxy 715 for packaging and unpacking data packets formatted inaccordance with various aspects of the present invention. Communicatingwith the server 750 is a database management system (DBMS) 780, whichmanages access to a database (not shown). The DBMS 780 and the database(not shown) can be located in the server itself, or can be locatedremotely on a remote database server (not shown). Running on the Webserver 760 is a database interface Applications Programming Interface(API) 770, which provides access to the DBMS 780. The client computer720 and the server computer 750 can communicate with each other througha network 790. When the client process, e.g., the Web browser 710,requests data from a database, the script or application 730 issues aquery, which is sent across the network (e.g. internet) 790 to theserver computer 750, where it is interpreted by the server process,e.g., the Web server 760. The client's 720 request to server 750 cancontain multiple commands, and a response from server 750 can return aplurality of result sets.

In one example, responses to client commands that are returned can beself-describing, and record oriented; (e.g. the data streams candescribe names, types and optional descriptions of rows being returned.)On the client side 720 the data can be a login record, or a StructuredQuery Language (SQL) command being in a language that the server side750 can accept, a SQL command followed by its associated binary data(e.g. the data for a bulk copy command), or an attention signal. When aconnection is desired, the client 720 can send a login data stream tothe server. Even though the client 720 can have more than one connectionto the server 750, each connection path can be established separatelyand in the same manner.

Once the server 750 has received the login record from the client 720 itcan notify the client that it has either accepted or rejected theconnection request. Like wise to send SQL command or batch of SQLcommands; then the SQL command (e.g. represented by a Unicode format)can be copied into the data section of a buffer and then sent to the SQLServer side 720. A SQL batch may span more than one buffer. In addition,various Open Data Base Connectivity (ODBC) routines can cause SQLcommand to be placed into a client message buffer, or can cause themessage buffer to be sent to the server. As illustrated in FIG. 7, thetracking component 722 enables relationship information to be carriedalong with the entity such that database operation can be performedwithout requirement of additional information from the database (e.g.,foreign key information that is part of associated graphs). Hence,information about related entities in a serialized payload can also beincluded in the serialized payload. Such an arrangement further enableusers to perform subsequent change processing on the entity'srelationship information (which can be more efficiently performed thanretrieval of the full related entity) and better discovery ofinformation concerning the related entity.

The word “exemplary” is used herein to mean serving as an example,instance or illustration. Any aspect or design described herein as“exemplary” is not necessarily to be construed as preferred oradvantageous over other aspects or designs. Similarly, examples areprovided herein solely for purposes of clarity and understanding and arenot meant to limit the subject innovation or portion thereof in anymanner. It is to be appreciated that a myriad of additional or alternateexamples could have been presented, but have been omitted for purposesof brevity.

Furthermore, all or portions of the subject innovation can beimplemented as a system, method, apparatus, or article of manufactureusing standard programming and/or engineering techniques to producesoftware, firmware, hardware or any combination thereof to control acomputer to implement the disclosed innovation. For example, computerreadable media can include but are not limited to magnetic storagedevices (e.g., hard disk, floppy disk, magnetic strips . . . ), opticaldisks (e.g., compact disk (CD), digital versatile disk (DVD) . . . ),smart cards, and flash memory devices (e.g., card, stick, key drive . .. ). Additionally it should be appreciated that a carrier wave can beemployed to carry computer-readable electronic data such as those usedin transmitting and receiving electronic mail or in accessing a networksuch as the Internet or a local area network (LAN). Of course, thoseskilled in the art will recognize many modifications may be made to thisconfiguration without departing from the scope or spirit of the claimedsubject matter.

In order to provide a context for the various aspects of the disclosedsubject matter, FIGS. 8 and 9 as well as the following discussion areintended to provide a brief, general description of a suitableenvironment in which the various aspects of the disclosed subject mattermay be implemented. While the subject matter has been described above inthe general context of computer-executable instructions of a computerprogram that runs on a computer and/or computers, those skilled in theart will recognize that the innovation also may be implemented incombination with other program modules. Generally, program modulesinclude routines, programs, components, data structures, and the like,which perform particular tasks and/or implement particular abstract datatypes. Moreover, those skilled in the art will appreciate that theinnovative methods can be practiced with other computer systemconfigurations, including single-processor or multiprocessor computersystems, mini-computing devices, mainframe computers, as well aspersonal computers, hand-held computing devices (e.g., personal digitalassistant (PDA), phone, watch . . . ), microprocessor-based orprogrammable consumer or industrial electronics, and the like. Theillustrated aspects may also be practiced in distributed computingenvironments where tasks are performed by remote processing devices thatare linked through a communications network. However, some, if not allaspects of the innovation can be practiced on stand-alone computers. Ina distributed computing environment, program modules may be located inboth local and remote memory storage devices.

As used in this application, the terms “component”, “system”, “engine”are intended to refer to a computer-related entity, either hardware, acombination of hardware and software, software, or software inexecution. For example, a component can be, but is not limited to being,a process running on a processor, a processor, an object, an executable,a thread of execution, a program, and/or a computer. By way ofillustration, both an application running on a server and the server canbe a component. One or more components can reside within a processand/or thread of execution, and a component can be localized on onecomputer and/or distributed between two or more computers.

Generally, program modules include routines, programs, components, datastructures, and the like, which perform particular tasks and/orimplement particular abstract data types. Moreover, those skilled in theart will appreciate that the innovative methods can be practiced withother computer system configurations, including single-processor ormultiprocessor computer systems, mini-computing devices, mainframecomputers, as well as personal computers, hand-held computing devices(e.g., personal digital assistant (PDA), phone, watch . . . ),microprocessor-based or programmable consumer or industrial electronics,and the like. The illustrated aspects may also be practiced indistributed computing environments where tasks are performed by remoteprocessing devices that are linked through a communications network.However, some, if not all aspects of the innovation can be practiced onstand-alone computers. In a distributed computing environment, programmodules may be located in both local and remote memory storage devices.

With reference to FIG. 8, an exemplary environment 810 for implementingvarious aspects of the subject innovation is described that includes acomputer 812. The computer 812 includes a processing unit 814, a systemmemory 816, and a system bus 818. The system bus 818 couples systemcomponents including, but not limited to, the system memory 816 to theprocessing unit 814. The processing unit 814 can be any of variousavailable processors. Dual microprocessors and other multiprocessorarchitectures also can be employed as the processing unit 814.

The system bus 818 can be any of several types of bus structure(s)including the memory bus or memory controller, a peripheral bus orexternal bus, and/or a local bus using any variety of available busarchitectures including, but not limited to, 11-bit bus, IndustrialStandard Architecture (ISA), Micro-Channel Architecture (MSA), ExtendedISA (EISA), Intelligent Drive Electronics (IDE), VESA Local Bus (VLB),Peripheral Component Interconnect (PCI), Universal Serial Bus (USB),Advanced Graphics Port (AGP), Personal Computer Memory CardInternational Association bus (PCMCIA), and Small Computer SystemsInterface (SCSI).

The system memory 816 includes volatile memory 820 and nonvolatilememory 822. The basic input/output system (BIOS), containing the basicroutines to transfer information between elements within the computer812, such as during start-up, is stored in nonvolatile memory 822. Byway of illustration, and not limitation, nonvolatile memory 822 caninclude read only memory (ROM), programmable ROM (PROM), electricallyprogrammable ROM (EPROM), electrically erasable ROM (EEPROM), or flashmemory. Volatile memory 820 includes random access memory (RAM), whichacts as external cache memory. By way of illustration and notlimitation, RAM is available in many forms such as synchronous RAM(SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rateSDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), anddirect Rambus RAM (DRRAM).

Computer 812 also includes removable/non-removable,volatile/non-volatile computer storage media. FIG. 8 illustrates a diskstorage 824, wherein such disk storage 824 includes, but is not limitedto, devices like a magnetic disk drive, floppy disk drive, tape drive,Jaz drive, Zip drive, LS-60 drive, flash memory card, or memory stick.In addition, disk storage 824 can include storage media separately or incombination with other storage media including, but not limited to, anoptical disk drive such as a compact disk ROM device (CD-ROM), CDrecordable drive (CD-R Drive), CD rewritable drive (CD-RW Drive) or adigital versatile disk ROM drive (DVD-ROM). To facilitate connection ofthe disk storage devices 824 to the system bus 818, a removable ornon-removable interface is typically used such as interface 826.

It is to be appreciated that FIG. 8 describes software that acts as anintermediary between users and the basic computer resources described insuitable operating environment 810. Such software includes an operatingsystem 828. Operating system 828, which can be stored on disk storage824, acts to control and allocate resources of the computer system 812.System applications 830 take advantage of the management of resources byoperating system 828 through program modules 832 and program data 834stored either in system memory 816 or on disk storage 824. It is to beappreciated that various components described herein can be implementedwith various operating systems or combinations of operating systems.

A user enters commands or information into the computer 812 throughinput device(s) 836. Input devices 836 include, but are not limited to,a pointing device such as a mouse, trackball, stylus, touch pad,keyboard, microphone, joystick, game pad, satellite dish, scanner, TVtuner card, digital camera, digital video camera, web camera, and thelike. These and other input devices connect to the processing unit 814through the system bus 818 via interface port(s) 838. Interface port(s)838 include, for example, a serial port, a parallel port, a game port,and a universal serial bus (USB). Output device(s) 840 use some of thesame type of ports as input device(s) 836. Thus, for example, a USB portmay be used to provide input to computer 812, and to output informationfrom computer 812 to an output device 840. Output adapter 842 isprovided to illustrate that there are some output devices 840 likemonitors, speakers, and printers, among other output devices 840 thatrequire special adapters. The output adapters 842 include, by way ofillustration and not limitation, video and sound cards that provide ameans of connection between the output device 840 and the system bus818. It should be noted that other devices and/or systems of devicesprovide both input and output capabilities such as remote computer(s)844.

Computer 812 can operate in a networked environment using logicalconnections to one or more remote computers, such as remote computer(s)844. The remote computer(s) 844 can be a personal computer, a server, arouter, a network PC, a workstation, a microprocessor based appliance, apeer device or other common network node and the like, and typicallyincludes many or all of the elements described relative to computer 812.For purposes of brevity, only a memory storage device 846 is illustratedwith remote computer(s) 844. Remote computer(s) 844 is logicallyconnected to computer 812 through a network interface 848 and thenphysically connected via communication connection 850. Network interface848 encompasses communication networks such as local-area networks (LAN)and wide-area networks (WAN). LAN technologies include Fiber DistributedData Interface (FDDI), Copper Distributed Data Interface (CDDI),Ethernet/IEEE 802.3, Token Ring/IEEE 802.5 and the like. WANtechnologies include, but are not limited to, point-to-point links,circuit switching networks like Integrated Services Digital Networks(ISDN) and variations thereon, packet switching networks, and DigitalSubscriber Lines (DSL).

Communication connection(s) 850 refers to the hardware/software employedto connect the network interface 848 to the bus 818. While communicationconnection 850 is shown for illustrative clarity inside computer 812, itcan also be external to computer 812. The hardware/software necessaryfor connection to the network interface 848 includes, for exemplarypurposes only, internal and external technologies such as, modemsincluding regular telephone grade modems, cable modems and DSL modems,ISDN adapters, and Ethernet cards.

FIG. 9 is a schematic block diagram of a sample-computing environment900 that can be employed for implementing the tracking component of thesubject innovation. The system 900 includes one or more client(s) 910.The client(s) 910 can be hardware and/or software (e.g., threads,processes, computing devices). The system 900 also includes one or moreserver(s) 930. The server(s) 930 can also be hardware and/or software(e.g., threads, processes, computing devices). The servers 930 can housethreads to perform transformations by employing the components describedherein, for example. One possible communication between a client 910 anda server 930 may be in the form of a data packet adapted to betransmitted between two or more computer processes. The system 900includes a communication framework 950 that can be employed tofacilitate communications between the client(s) 910 and the server(s)930. The client(s) 910 are operatively connected to one or more clientdata store(s) 960 that can be employed to store information local to theclient(s) 910. Similarly, the server(s) 930 are operatively connected toone or more server data store(s) 940 that can be employed to storeinformation local to the servers 930.

What has been described above includes various exemplary aspects. It is,of course, not possible to describe every conceivable combination ofcomponents or methodologies for purposes of describing these aspects,but one of ordinary skill in the art may recognize that many furthercombinations and permutations are possible. Accordingly, the aspectsdescribed herein are intended to embrace all such alterations,modifications and variations that fall within the spirit and scope ofthe appended claims.

Furthermore, to the extent that the term “includes” is used in eitherthe detailed description or the claims, such term is intended to beinclusive in a manner similar to the term “comprising” as “comprising”is interpreted when employed as a transitional word in a claim.

What is claimed is:
 1. A method, implemented at a computer system thatincludes one or more processors, the method comprising: retrieving adata object; serializing the data object; and preserving relationshipsassociated with the data object by attaching key information to the dataobject, and wherein a retrieval of a relationship varies according towhether a value included in the key information is null or non-null. 2.The method of claim 1, further comprising reconstructing a graph viaserialized key information.
 3. The method of claim 1, further comprisingtransferring the data object among various tiers of a database.
 4. Themethod of claim 3, further comprising obtaining reference relationshipsfor the data object from the database.
 5. The method of claim 4, furthercomprising deserializing the data object.
 6. The method of claim 4,further comprising mitigating a requirement to reload data objects fromthe database.
 7. The method of claim 4, further comprising attaching thedata object to a tracking context.
 8. The method of claim 4, furthercomprising including information for the data object in a serialized payload.
 9. The method of claim 4, further comprising inferring a trackingof the data object via classifiers.
 10. The method of claim 4, furthercomprising representing the data object through a proxy.
 11. A hardwarestorage device having instructions stored thereon, the instructionsconfigured to, in response to execution by one or more computingdevices, cause operations including: retrieving a data object; andattaching key information to the data object via serialization, whereinthe key information facilitates preserving relationships associated withthe data object, and wherein a retrieval of a relationship variesaccording to whether a value included in the key information is null ornon-null.
 12. The hardware storage device of claim 11, wherein theoperations further include associating the key information with acustomer class.
 13. The hardware storage device of claim 11, wherein theoperations further include transporting the key information as a proxyfor the data object during the serialization.
 14. The hardware storagedevice of claim 13, wherein the operations further include attaching thedata object to a tracking context.
 15. The hardware storage device ofclaim 14, wherein the tracking context facilitates replacing the proxywith the data object in a graph.
 16. A computer implemented systemcomprising at least one processor and at least one hardware storagedevice having stored thereon instructions executable by the at least oneprocessor to: retrieve a data object; and attach key information to thedata object via serialization, wherein the key information facilitatespreserving relationships associated with the data object, and wherein aretrieval of a relationship varies according to whether a value includedin the key information is null or non-null.
 17. The computer-implementedsystem of claim 16, wherein the instructions are also executable by theat least one processor to retrieve the at least one of the plurality ofrelationships from a state manager when the value is non-null.
 18. Thecomputer-implemented system of claim 16, wherein the instructions arealso executable by the at least one processor to retrieve the at leastone of the plurality of relationships from a source data object when thevalue is null.
 19. The computer-implemented system of claim 16, whereinthe instructions are also executable by the at least one processor toretrieve the at least one of the plurality of relationships from aprivate field when the data object is detached.
 20. Thecomputer-implemented system of claim 19, wherein the at least one of theplurality of relationships included in the private field is set duringserialization.